package com.xl.xlservice1.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xl.xlservice1.mapper.OrderMapper;
import com.xl.xlservice1.model.Order;
import com.xl.xlservice1.service.OrderService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;

    @Override
    @GlobalTransactional
    public void addOrder(Order order) {
        orderMapper.insert(order);
    }

    @Override
    public List<Order> queryOrder(Order order) {
        return orderMapper.selectList(new LambdaQueryWrapper<Order>().eq(Order::getId,order.getId()));
    }
}
